//
//  InCostsViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/27.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "InCostsViewModel.h"
#import "InpCostsModel.h"

@implementation InCostsViewModel

-(void)getInCostsInfoWithPage:(NSString *)page success:(void (^)())completion{
    //{db:"OracleString",SqlNo:"10",patient_id:"90000476",visit_id:"1",Page:"1"}
    NSDictionary *info = @{@"db":@"OracleString",@"SqlNo":@"10",@"patient_id":[User currentUser].patientId,@"visit_id":@"1",@"Page":page};
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,COMMON_URL];
    [NetWorker getCommonDatasWithURLStr:url body:info success:^(id result) {
        NSArray *resultArr = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *modelArr = [NSMutableArray array];
        for (NSString *jsonStr in resultArr) {
            InpCostsModel *model = [InpCostsModel yy_modelWithJSON:jsonStr];
            [modelArr addObject:model];
        }
        _datasArray = modelArr;
        completion(modelArr);
    } failure:^(id result) {
        completion([NSArray array]);
    }];

}

@end
